
import turtle
import random

def draw_firework():
    # 设置画笔速度
    turtle.speed('fastest')
    # 隐藏画笔
    turtle.hideturtle()
    # 随机颜色
    colors = ["red", "orange", "yellow", "green", "blue", "purple"]

    for _ in range(100):
        # 随机角度和长度
        angle = random.randint(0, 360)
        length = random.randint(50, 150)
        # 随机颜色
        color = random.choice(colors)
        # 绘制线条
        turtle.color(color)
        turtle.right(angle)
        turtle.forward(length)
        turtle.backward(length)
        turtle.left(angle)

draw_firework()
turtle.done()